﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class RoomSlot : MonoBehaviour
{
    public Text UserNameLabel;
    public Text TotalLabel;
    public Text WinLabel;
    public Button JoinBtn;

    private void Start()
    {
        if (JoinBtn != null)
            JoinBtn.onClick.AddListener(OnJoin);
    }

    public void SetData(string _userName, int total, int win)
    {
        if (UserNameLabel != null)
            UserNameLabel.text = _userName;
        if (TotalLabel != null)
            TotalLabel.text = string.Format("总场数:\n{0}", total);
        if (WinLabel != null)
            WinLabel.text = string.Format("胜场数:\n{0}", win);
    }

    public void SetData(string _userName, string total, string win)
    {
        if (UserNameLabel != null)
            UserNameLabel.text = _userName;
        if (TotalLabel != null)
            TotalLabel.text = string.Format("总场数:\n{0}", total);
        if (WinLabel != null)
            WinLabel.text = string.Format("胜场数:\n{0}", win);
    }

    public void OnJoin()
    {

    }

    public void DestroySelf()
    {
        GameObject.Destroy(this.gameObject);
    }
}
